#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <map>
using namespace std;

class Solution {
    public:
        int lengthOfLongestSubstring(string s) 
        {
            int cha[300] = {0};
            int i=0,j=0,res=0;
            while(j!=s.length()){
                if(cha[s[j]]){
                    for(int k=i;k<cha[s[j]]-1;k++)
                        cha[s[k]]=0;
                    i = cha[s[j]];
                }
                cha[s[j]] = j+1;
                j++;
                res = res>(j-i)?res:(j-i);
            }
            return res; 
        }
};

int main()
{
    return 0;
}
